import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;


public class Building implements GameObject{

	int x;
	int y;
	//boolean inprog;
	boolean m1;
	boolean m2;

	Building(int x, int y){
		this.x = x;
		this.y = y;
		//inprog = false;
		m1 = false;
		m2 = false;
	}


	@Override
	public void actionPerformed(ActionEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void keyPressed(KeyEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void keyReleased(KeyEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void keyTyped(KeyEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseClicked(MouseEvent arg0) {

		if(arg0.getY() >= 600 && arg0.getY() <= 1030 && m1 == false){
			m1 = true;
			System.out.println("This just happened");
		}
		else if(m1 == true){
			m2 = true;
			m1 = false;
			System.out.println("asdf");
		}

	}

	@Override
	public void mouseEntered(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseExited(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mousePressed(MouseEvent arg0) {

	}

	@Override
	public void mouseReleased(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseDragged(MouseEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseMoved(MouseEvent arg0) {

		if(m1 == true){
			x = arg0.getX();
			y = arg0.getY();
		}
	}

	@Override
	public void mouseWheelMoved(MouseWheelEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public Shape getShape() {
		return null;
	}

	@Override
	public Color getColor() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public double getX() {
		return x;
	}

	@Override
	public double getY() {
		return y;
	}

	public void paint(Graphics2D g){
		try {
			BufferedImage bi = ImageIO.read(new File("src/res/hammer.gif"));
			g.fillRoundRect(x, y, 100, 100, 25, 25);
			g.setColor(new Color(255, 0, 0));
			g.fillRect(x + 50/3, y + 50/3, 100/3, 100/3);
			g.fillRect(x + 150/3, y + 150/3, 100/3, 100/3);
			g.drawImage(bi, x + 150/3, y + 50/3, 100/3, 100/3, null);
			g.drawImage(bi, x + 50/3, y + 150/3, 100/3, 100/3, null);
		} catch (IOException e) {
			System.out.println("ERROR 404: File not found");
		}
	}

}
